package lesbonsamis;

import java.text.DecimalFormat;

public class Utils {

	static private final DecimalFormat df = new DecimalFormat("0.00");
		
	static public Integer depuisDevise(String s) {
		s = s.replace(',', '.');
		Double d;
		try {
			d = Double.parseDouble(s);
		} catch (Exception e) {
			d = 0.0;
		}
		return (int) Math.round(100*d);
	}
	
	static public String versDevise(Integer i) {
		String res = "";
		if (i != null) {
			double d = (double) i/100;
			res = df.format(d);
		}		
		return res;
	}
	
}
